package ai.people.netmon.signal.controller;

import ai.people.netmon.framework.domain.signal.entity.SignalUser;
import ai.people.netmon.framework.domain.signal.vo.SignalUserVO;
import ai.people.netmon.framework.model.response.Result;
import ai.people.netmon.framework.utils.ResultUtil;
import ai.people.netmon.signal.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 账号接口
 *
 * @author yuanqinglong
 * @date 2022/4/25 15:42
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/user")
public class UserController {

    /**
     * 用户服务impl
     */
    private final UserService userServiceImpl;

    /**
     * 通过用户名获取账号信息
     *
     * @param username 用户名
     * @return {@link Result}<{@link SignalUserVO}>
     */
    @GetMapping("/{username}")
    public Result<SignalUserVO> getAccountByUsername(@PathVariable("username") String username) {
        return ResultUtil.success(userServiceImpl.getUserByUsername(username));
    }
}
